package unit2;


public class Ex2_9_WhileDemo {
    public static void main(String[] args) {
        int i = 1; //初始化循环变量i
        int s = 0; //初始化累加求和变量s
        while (i <= 100) {
            s = s + i; // 累加求和
            i++; // 迭代，变更循环条件
        }
        System.out.println("1+2+3+……+100之和为：" + s);
    }
}
